function printCoord(obj: { first: string, last?: string }): void {
    console.log(`obj first: ${obj.first}`);
    // console.log(`obj last: ${obj.last || '没有'}`);
    // if (obj.last !== undefined) {
    //     console.log(`obj last: ${obj.last.toUpperCase()}`);
    // }
    console.log(`obj last: ${obj.last?.toUpperCase()}`);
}

printCoord({first: 'diaomao'})
printCoord({first: 'diao-', last: 'mao'})
